#if defined myhooks_dll_inc
 #endscript
#endif
#define myhooks_dll_inc

#pragma library "myhooks"



#define HOOK_TYPE_E8	1
#define HOOK_TYPE_FF15	2
#define HOOK_TYPE_8B1D	3
#define HOOK_TYPE_E9	4

native myhook_install(hook_type, address, func_addr);

#define HOOK_FUNC_YES	1
#define HOOK_FUNC_NO	2
#define HOOK_FUNC_NICK	3
#define HOOK_FUNC_CHAT	4
#define HOOK_FUNC_VOID	5

native myhook_getfunc(func_type);

native myhook_register(func_type, func_name[]);

//native myhook_call_issi(address, i1, const s1[], const s2[], i2);
native myhook_call_iissi(address, i0, i1, const s1[], const s2[], i2);
native myhook_call_iii(address, i0, i1, i2);
//native myhook_call_ii(address, i1, i2);
native myhook_call_i(address, i0);


#include <a_samp>

#define SERVER_VERSION_UNKNOWN 	0
#define SERVER_VERSION_03AR0	2
#define SERVER_VERSION_03AR3	3
#define SERVER_VERSION_03AR4	4
#define SERVER_VERSION_03AR5	5
#define SERVER_VERSION_03AR6	6
#define SERVER_VERSION_03AR7	7
#define SERVER_VERSION_03AR8	8
#define SERVER_VERSION_03AR9	9

#define SERVER_VERSION_03BR0	10
#define SERVER_VERSION_03BR2	12

#define SERVER_VERSION_03CR0	20
#define SERVER_VERSION_03CR2	22


stock GetServerVersion()
{
	new ver[20];
	GetServerVarAsString("version", ver, sizeof(ver));
	if(!ver[0]) return SERVER_VERSION_UNKNOWN;
	if(ver[4] == 'R')
	{
		if(ver[3] == 'a')
		{
			if(!ver[7])
				return(ver[6]-'0'); // 0.3a RX
			else
				return(strval(ver[6])); // 0.3a RXXX....
		}
		else if(ver[3] == 'b')
		{
			if(!ver[7])
				return(ver[6]-'0'+10); // 0.3b RX
			else
				return(strval(ver[6])+10); // 0.3b RXXX....
		}
    
		else if(ver[3] == 'c')
		{
			if(!ver[7])
				return(ver[6]-'0'+20); // 0.3c RX
			else
				return(strval(ver[6])+20); // 0.3c RXXX....
		}
		else if(ver[2] == 'a') // YYa RY
		{
			if(!ver[6])
				return(ver[5]-'0'); // 0.3a RX
			else
				return(strval(ver[5])); // 0.3a RXXX....
		}
		else if(ver[2] == 'b')
		{
			if(!ver[6])
				return(ver[5]-'0'+10); // 0.3b RX
			else
				return(strval(ver[5])+10); // 0.3b RXXX....
		}
    
		else if(ver[2] == 'c')
		{
      
			if(!ver[6])
				return(ver[5]-'0'+20); // 0.3c RX
			else
				return(strval(ver[5])+20); // 0.3c RXXX....
      		}
	}
	else if(!ver[4]) // 0.3x
	{
		if(ver[3] == 'a' || ver[2] == 'a')
			return SERVER_VERSION_03AR0;
		else if(ver[3] == 'b' || ver[2] == 'b')
			return SERVER_VERSION_03BR0;
		else if(ver[3] == 'c' || ver[2] == 'c')
			return SERVER_VERSION_03CR0;
	}
	return SERVER_VERSION_UNKNOWN;
}








